package com.simoniu.first;

import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.annotation.*;

@WebServlet(name = "helloServlet", value="/hello",loadOnStartup =2)
public class HelloServlet extends HttpServlet {

    public HelloServlet(){
        System.out.println("执行了HelloServlet的构造方法...");
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException {
        doPost(request,response);

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("执行了HelloServlet doPost...");
        System.out.println("servlet对象的hashCode:"+this.hashCode());
        System.out.println("当前线程ID："+Thread.currentThread().getId());
    }

    public void destroy() {
    }
}